// @ts-ignore
/* eslint-disable */
import {request} from 'umi';
import {RecognizeListItem} from './data';

export async function loadRecognize(
  params: {
    // query
    /** 当前的页码 */
    current?: number;
    /** 页面的容量 */
    pageSize?: number;
  }) {
  return request<{
    data: RecognizeListItem[];
    /** 列表的内容总数 */
    total?: number;
    success?: boolean;
  }>('/v2/enterprise/recognize/list', {
    method: 'GET',
    params: {
      ...params,
      pageNum: params.current,
      // orderByColumn: "recognizeSort",
      isAsc: 'desc'
    },
  });
}

export async function getRecognize(param: { recognizeId?: number }): Promise<{ data: RecognizeListItem }> {
  console.log(param)
  return request(`/v2/enterprise/recognize/${param.recognizeId}`, {method: "GET"});
}

export async function addRecognize(param: RecognizeListItem): Promise<{ data: number }> {
  return request('/v2/enterprise/recognize', {method: "POST", data: param});
}

export async function updateRecognize(param: RecognizeListItem): Promise<{ data: number }> {
  return request('/v2/enterprise/recognize', {method: "PUT", data: param});
}

export async function removeRecognize(data: number[]) {
  return request<Record<string, any>>(`/v2/enterprise/recognize/` + data.join(), {method: 'DELETE'});
}

export async function loadDictSelect(type: string) {
  return request(`/v2/enterprise/dict/` + type);
}
